<!DOCTYPE html>
<html lang="en" xmlns:height="http://www.w3.org/1999/xhtml" xmlns:width="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"></meta>
    <title>处方笺</title>
</head>
<script type="text/javascript" src="/static/js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="/static/js/JsBarcode.all.min.js"></script>
<script language="javascript">
    function preview(oper) {
        if (oper < 10) {
            bdhtml = window.document.body.innerHTML;//获取当前页的html代码
            sprnstr = "<!--startprint" + oper + "-->";//设置打印开始区域
            eprnstr = "<!--endprint" + oper + "-->";//设置打印结束区域
            prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html
            prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//从结束代码向前取html
            window.document.body.innerHTML = prnhtml;
            window.print();
            window.document.body.innerHTML = bdhtml;
        } else {
            window.print();
        }
    }
</script>
<script type="text/javascript" window.onresize=ietest; >

    function getValue(obj) {
        var type = obj.type
        if (type == 'text' || type.name == "textarea") {
            var previous = obj.previousSibling;
            previous.innerHTML = obj.value
            obj.style.display = "none";
            previous.style.display = "inline";
        }
        else {
            var index = obj.selectedIndex; // 选中索引
            var text = obj.options[index].text; // 选中文本
            var span = document.getElementById('selspan');
            span.innerHTML = text;
            document.getElementById('sel').style.display = "none";
            span.style.display = "inline";
        }

    }

    function setValue(obj) {
        event.stopPropagation();
        var next = obj.nextSibling;
        if (next.type == "text" || next.name == "textarea") {
            next.innerHTML = obj.value
            next.style.display = "inline";
            obj.style.display = "none";
        } else {
            document.getElementById('sel').style.display = "inline";
            document.getElementById('selspan').style.display = "none";
        }
    }

    function getTextareaValue(obj) {
        var type = obj.type
        var previous = obj.previousSibling;
        var result=obj.value.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>');
        previous.innerHTML =result;
        obj.style.display = "none";
        previous.style.display = "inline";
    }

    function setTextareaValue(obj) {
        event.stopPropagation();
        var next = obj.nextSibling;
        var result=obj.value.replace( '<br/>',/\r\n/g).replace( '<br/>',/\n/g);
        next.innerHTML = result
        next.style.display = "inline";
        obj.style.display = "none";
    }
    var ietest=function()
    {
        if ($.browser.msie) {
            if ($.browser.version == "6.0")
            {
                var _width=document.documentelement.clientwidth+29; //桌面分辨率大小
                $("#nav").css教程("left",((_width-950)/2)-15); //重新设置值
                return false;
            }
            return false;
        }
        return false;
    }



</script>

<style>
    .container {
        height: 210mm;
        width: 148mm;
        margin: 8px auto 15px;
    }

    .tb {
        table-layout: fixed;
        word-break: break-all;
    }

    .in {
        width: 15mm;
    }

    .di {
        margin:0;padding:0;
        position: absolute;
        bottom: 5mm;
    }

    body {
        background: url(/static/img/docter.jpg) no-repeat;
        background-size: cover;
        background-attachment: fixed;
        background-color: #CCCCCC;
    }
</style>
<style type="text/css" media="print">
    .noprint {
        display: none;
    }
</style>
<body style="font-family: 华文宋体">
<!--startprint1-->
<div class="container">
    <div class="row" style="">
        <div>
            <table width="100%">
                <tbody>
                <tr>
                    <td>请到 门诊一药房 取药！</td>
                    <td>
                        <strong style="border:1px solid black;padding-right: 15mm;font-size: 25px">普</strong>
                    </td>
                </tr>
                <tr>
                </tr>
                </tbody>
            </table>

            <h1 class="text-center" style="text-align:center">
                杨凌示范区医院处方笺
            </h1>

            <table width="100%" border="0" class="tb">
                <tr>
                    <td><b>全自费</b></td>
                    <td>处方号:<span onclick=setValue(this)>[[${recipecode}]]</span></td>
                </tr>
                <tr>
                    <td>科&nbsp;&nbsp;别:
                        <span onclick=setValue(this) id="selspan"></span>
                        <span id="sel">
                            <select onblur=getValue(this)>
                                <option value="opel">&nbsp;&nbsp;内科</option>
                                <option value="audi">&nbsp;&nbsp;外科</option>
                                <option value="volvo">&nbsp;&nbsp;口腔科</option>
                                <option value="saab">&nbsp;&nbsp;皮肤科</option>
                            </select>
                        </span>

                    </td>
                    <td>门诊号:<span onclick=setValue(this)>[[${diagnosecode}]]</span></td>
                </tr>
                <tr>
                    <td>姓&nbsp;&nbsp;名:<span onclick=setValue(this)></span><input type="text" value="&nbsp;&nbsp;"
                                                                                  class="in" onblur=getValue(this)>&nbsp;&nbsp;性别:<span
                            onclick=setValue(this)></span><input type="text" value="&nbsp;&nbsp;" class="in"
                                                                 onblur=getValue(this)></td>
                    <td>年&nbsp;&nbsp;&nbsp;龄:<span onclick=setValue(this)></span><input type="text" value="&nbsp;&nbsp;"
                                                                                        class="in"
                                                                                        onblur=getValue(this)></td>
                </tr>
                <tr>
                    <td>日&nbsp;&nbsp;期:<span onclick=setValue(this)>[[${date}]]</span></td>
                    <td></td>
                </tr>
            </table>
            <hr color="#404452"/>
            <strong>
                临床诊断/症状:
                <span onclick=setValue(this)></span><textarea class="rn" name="textarea"
                                                              onblur=getTextareaValue(this)
                                                              style="height: 20mm;width: 130mm;">&emsp;&emsp;</textarea>
            </strong>

            <hr color="#404452"/>
            <h2>
                RP
            </h2>
            <span onclick=setValue(this)></span><textarea id="rn" value="&nbsp;&nbsp;" name="textarea"
                                                          onblur=getTextareaValue(this)
                                                          style="height: 20mm;width: 130mm">&emsp;&emsp;</textarea>
            <br>
        </div>
        <div class="di" style="">
            <hr color="#404452"/>
            <table width="100%" border="0" class="tb">
                <tr>
                    <td>药费总计______________________</td>
                    <td>医&nbsp;&nbsp;&nbsp;师______________________</td>
                </tr>
                <tr>
                    <td>调&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;剂______________________</td>
                    <td>核对人______________________</td>
                </tr>
            </table>
            <img id="imgcode" alt="未获取到内容" style="height: 15mm;width: 40mm;margin-left: 10mm"/>
            <script>
                var code = [[${diagnosecode}]];
                $("#imgcode").JsBarcode("*" + code);
            </script>
            <input class="noprint" type=button name='button_export' style="width: 20mm;height: 15mm" title='打印'
                   onclick=preview(1) value=打印>
        </div>
    </div>
</div>
<!--endprint1-->

</body>

</html>